#pragma once

#define CLK_COLOR_BLACK clkColor(0,0,0,1)
#define CLK_COLOR_WHITE clkColor(1,1,1,1)
#define CLK_COLOR_RED   clkColor(1,0,0,1)
#define CLK_COLOR_GREEN clkColor(0,1,0,1)
#define CLK_COLOR_BLUE  clkColor(0,0,1,1)

struct clkColor
{
	float r, g, b, a;

	clkColor()
	{
		r = g = b = a = 1.0f;
	}

	clkColor(float a_rgba)
	{
		r = g = b = a = (a_rgba>1.0f)?1.0f:(a_rgba<0.0f)?0.0f:a_rgba;
	}

	clkColor(float a_r,float a_g,float a_b, float a_a)
	{
		r = (a_r>1.0f)?1.0f:(a_r<0.0f)?0.0f:a_r;
		g = (a_g>1.0f)?1.0f:(a_g<0.0f)?0.0f:a_g;
		b = (a_b>1.0f)?1.0f:(a_b<0.0f)?0.0f:a_b;
		a = (a_a>1.0f)?1.0f:(a_a<0.0f)?0.0f:a_a;
	}

	float operator[](int i)
	{
		return (i==0)?r:(i==1)?g:(i==2)?b:(i==3)?a:0;
	}

	clkColor operator+(clkColor c)
	{
		return clkColor(r+c.r,g+c.g,b+c.b,a+c.a);
	}

	clkColor operator-(clkColor c)
	{
		return clkColor(r-c.r,g-c.g,b-c.b,a-c.a);
	}

	clkColor operator*(clkColor c)
	{
		return clkColor(r*c.r,g*c.g,b*c.b,a*c.a);
	}
};